package com.imu.constant;

import java.math.BigDecimal;

/**
 * Created by Administrator on 2017/3/15.
 */
public interface Constant
{
	public static final long SESSION_TIMEOUT = 604800;//会话超时时间 7
	
	public static final Integer EXECUTORS_COUNT = 10;//异步线程数

	public static final Integer ACODE_LEN = 6; 	//验证码长度
	
	public static final int POOL_COUNT = 10;    	//线程个数
	
	public static final int POOL_DELAYED = 60;    	//线程延迟时间秒
	
	public static final String SEQ = "seq";		//编号序列
	
	public static final String SUCCESS = "SUCCESS";//成功
	
	public static final String DEF_CODE = "123456"; //默认验证码
	
	public static final String FAIL = "FAIL";//失败
	
	public static final String PRO_NAME = "XCHAT"; //产品名称
	
	public static final String MQ_PAY_TAG = "XCHAT_PAY";
	
	public static final Integer ENABLE = 1;//启用
	
	public static final Integer UNABLE = 0;//关闭
	
	public static final Integer YES =  1; //是
	
	public static final Integer NO  = 0;  //否

	public static final Integer DEL = -1;  //删除
	
	public static final Integer DEF =  0; //默认

	public static final Integer SUC =  1; //成功
	
	public static final Integer FAI = -1; //失败
	
	public static final String PROFILE_KEY = "u:profile"; //用户基础信息

	public static final String SYS_DICT = "sys:dict"; //系统字典缓存
	
	public static final String SYS_GIFT_SET = "sys:gift:set"; //系统礼物缓存
	
	public static final String SYS_GIFT_HASH = "sys:gift:hash"; //系统礼物缓存

	public static final String VIR_GOODS_FIX = "xin_coin_"; 		//虚拟商品ID前缀
	
	public static final String VIR_GOODS_SET = "sys:goods:set"; 	//系统商品缓存
	
	public static final String VIR_GOODS_HASH = "sys:goods:hash"; 	//系统商品缓存
	
	public static final String USER_TAG_HASH = "u:tag:"; 	//用户标签缓存

	public static final String USER_PURSE_KEY = "u:purse"; 		//用户财富钱包缓存
	
	public static final String USER_RPURSE_KEY = "u:rpurse"; 	//用户财富钱包缓存
	
	public static final String USER_ANALY_KEY = "u:analy"; 		//用户财富统计数据

	public static final String MIND_DAY_SET = "rich:mind:day:"; //心意财富最近15天统计

	public static final String ATTR_DAY_SET = "rich:attr:day:"; //吸引财富最近15天统计
	
	public static final String MOBILE = "m"; //移动端
	
	public static final String PC = "p"; //PC端
	
	public static final String SESSION_FIX = "s:"; //session 开头
	
	public static final Long INV_MIN_CODE = 123456L;
	
	public static final float SCALE = 0.7f;
	
	public static final Long MIN_WITH_DRAW = 100000L; //最小提现金额
	public static final Long MONEY_SCALE = 10L; 	  //金额跟虚拟积分比例
	public static final float WD_SCALE = 0.7f;

	public static final int SYS_GRADE = -14; 	//等级最近15天合
	public static final int SYS_WEEK  = -6; 	//等级最近7天合

	public static final int GRADE_DE = 0; 	 //等级状态 未激活
	public static final int GRADE_EN = 1; 	 //等级状态 激活
	
	public static final String BITCOIN_HEIGHT = "bitcoin-height"; //上一次请求bitcoin的区域高度
	public static final  String YTFCOIN_HEIGHT = "ytfcoin-height";//上一次青铜以太坊的区域高度
	public static final Long TRANSFER_OUT_ID = -100L; //转账给外部人默认用户id
	
	public static final String MONEY_PACKAGE_CONNECT_ERROR = "-100"; //钱包连接异常
	public static final String MONEY_PACKAGE_CONNECT_OTHER_ERROR = "-1"; //钱包其他异常
	
	public static final String BITCOIN_SCHEDULE_NAME = "bitcoin_name";//bit定时任务

	public static final String YTFCOIN_SCHEDULE_NAME = "ytfcoin_name";//以太坊定时任务

	public static final String TRANSFER_SEND = "send";//转出

	public static final String TRANSFER_RECEIVE = "receive";//转出
	
	public static final BigDecimal DEFAULT_RATE = (new BigDecimal("0.5")).setScale(1,BigDecimal.ROUND_DOWN);//转出交易费最低值
	
	public static final String MONEY_ADDR_KEY = "MONEY_ADDR";//缓存中与用户的手机号绑定

	public static final String CORE_MONEY_KEY = "core_money_address";//核心钱包的key

	public static final String CORE_MONEY_SUFFIX = "core_money";//缓存中核心钱包地址与用户id的key的后缀

	public static final String CORE_MONEY_TRANS_EXPIRE = "CORE_MONEY_TRANS_EXPIRE";//核心钱包交易过期的缓存key

	public static final String CORE_MONEY_USER_KEY = "core_money_user_key";
	public static final String USER_CORE_MONEY_KEY = "user_core_money_key";
	
	public static final String USER_CHECK_VAL = "user_Check_val";

	public static final String OK = "OK";

	public static final String TRANS_CONSUMER_TIME = "trans:consumer:time";

	public static final BigDecimal DAY_MONEY = new BigDecimal(100); //每天转的最大imu数量

	public static final int MIN_ADDRESS_LEN = 27; //核心钱包最短地址

	public static final int MAX_ADDRESS_LEN = 34; //核心钱包最长地址

	public static final int YTF_TRANSFER_ACCOUNT_NEXIST = -32000;

	public static final int USER_ENABLE = 1;//用户可用

	public static final String YTF_PREFIX = "0x";//以太坊地址特征

	//公司大钱包地址  生产环境需要修改
	// 生产环境
	public static final String IMU_MONEY_INNER_ADDRESS = "0x100aac6042eac6c1c5092628dc873ebfb6c2d9d2";
	public static final String IMU_MONEY_INNER_PWD = "10000000000zfKfbP7X";
	//测试环境
	//public static final String IMU_MONEY_INNER_ADDRESS = "0x16488a864877ec4a739c5890ba6cf23ba40895c8";
	//public static final String IMU_MONEY_INNER_PWD = "18071519815GtdzaMy0";



	public static final String TRANS_OUT_FLAG = "TRANS_OUT_FLAG";//外部转账标记
	public static final String  OUT_FLAG = "OUT_FLAG";//外部转账标记
	public static final String CHAIN_FLAG = "CHAIN_FLAG"; //上链标记

	//密码为123456
	public static final String MD5_123456 = "e10adc3949ba59abbe56e057f20f883e";
	//密码为654321
	public static final String MD5_654321 = "c33367701511b4f6020ec61ded352059";
	
	public static final String CFG_COWRY_COUNT_KEY = "COWRY_COUNT_KEY";
	public static final String PRI_USER_KEY = "PRI_USER_KEY";
	public static final String REDIS_CFG_KEY = "sys:config";

	public static final String TRANS_KEY = "TRANS_KEY"; //转账标记

	public static final String HY_IP = "HY_IP"; //合赢系统IP

	//  -- 函数：私募贝壳信息
	//  -- 成功，则返回1，如果不成功，则返回空
	//  -- 函数：返回-9私募结束
	//  -- 函数：返回-1没找到记录
    //  -- 参数值：KEYS[1] 缓存KEY
    //  -- 参数值：ARGV[1] key,
    //  -- 参数值：ARGV[2] 私募个数
    public static final String PRI_COWRY_SCRIPT = "if redis.call('hexists', KEYS[1], ARGV[1]) ~= 1 then\n"
		                                     	+ "return tostring(-1)\n"
	                                            + "else\n"
	                                            + "local dto = redis.call('hget', KEYS[1], ARGV[1]);\n"
	                                            + "if (dto ~= nil and dto) then\n"
	                                            + "local x = cjson.decode(dto);\n"
	                                            + "if (0 >= tonumber(x.value)) then\n"
		                                     	+ "return tostring(-1)\n"
	                                            + "end\n"
	                                            + "if (tonumber(x.value) < tonumber(ARGV[2])) then\n"
		                                     	+ "return tostring(-9)\n"
	                                            + "end\n"
	                                            + "local xx = tonumber(x.value) - tonumber(ARGV[2]);\n"
	                                            + "x['value'] = tonumber(xx)\n"
	                                            + "local re = cjson.encode(x);\n"
	                                            + "redis.call('hset', KEYS[1], ARGV[1], re);\n"
	                                            + "return tostring(xx);\n"
	                                            + "end\n"
	                                            + "end\n"
	                                            + "return nil";
    
    interface User
	{
    	//状态 正常
    	public static final Integer ACTIVE = 1;
		//状态 禁用
    	public static final Integer SUSPENDED = 0;
		//已删除
    	public static final Integer DEL = -1;
		//在线
    	public static final Integer ONLINE = 1;
		//离线
    	public static final Integer OFFLINE = 0;
		//在直播
    	public static final Integer ONLIVE = 1;
		//未直播
    	public static final Integer OFFLIVE = 0;
		//首次登陆
    	public static final Integer LONGIN_F = 1;
		//非首次
    	public static final Integer LONGIN_D = 0;
    	//非推荐注册
    	public static final Integer INV_DEF = -1;
    	//推荐注册
		public static final Integer INV_REG  = 0;
		//推荐领奖
		public static final Integer INV_SUC  = 1;
		//未认证
		public static final Integer AUTH_DEF =  0;
		//认证中
		public static final Integer AUTH_SUC =  1;
		//认证通过
		public static final Integer AUTH_PAS =  2;
		//认证失败
		public static final Integer AUTH_FAI = -2;
		//默认性别
		public static final Integer GENDER = -1;
		//默认性别 0女
		public static final Integer WOMAN = 0;
		//默认性别1男
		public static final Integer MAN = 1;
		//默认最大等级权限
		public static final Integer MAX_RANK = 0;
		//昵称前缀
		public static final String NICK_FIX = "x"; 	
		//才艺被点播
		public static final Integer TAG_CLICKED = 0;
		//才艺点播
		public static final Integer TAG_CLICK = 1;
		//才艺次数
		public static final Long DEF_COUNT = 1l;
		//送出礼物
		public static final Integer GIFT_SEND = 1;
		//收到礼物
		public static final Integer GIFT_RECE = 0;
	}
    
    interface WithDraw
	{
    	//成功
    	public static final Integer SUC = 1;
		//处理中 Handle
    	public static final Integer HANDLE = 0;
		//失败
    	public static final Integer FAI = -1;
		//提现最小金额
    	public static final Long MIN = 100000L;
    	
	}
    
    interface ScheduleStatus{
    	public static final Integer FAIL = 0;
    	public static final Integer SUCCESS = 1;
    }

    interface SMS_COUNT{
    	public static final int MCOUNT = 1; //1分钟数量
    	public static final int HCOUNT = 10; //1小时数量
    	public static final int DCOUNT = 30; //1天的数量
	}

	interface  DATE_TAG{
    	public  static final int MINTURE = 1;
    	public static final int HOUR = 2;
    	public static final int DAY = 3;
	}

	interface MAX_OUT{ //外部转账标记
    	static final String MAX_OUT = "MAX_OUT";
    	static final String MAX_OUT_FLAG = "MAX_OUT_FLAG";
	}
}
